#include "HeadView.h"


HeadView::HeadView(void)
	:_ui( nullptr )
	,_hpPro( nullptr )
	,_hpText( nullptr )
	,_mpPro( nullptr )
	,_mpText( nullptr )
{
}


HeadView::~HeadView(void)
{
}

bool HeadView::init()
{
	if ( !Layer::init() ){ return false; }

	_ui = cocostudio::GUIReader::getInstance()->widgetFromJsonFile("ui/head_1/head_1.ExportJson"); 
	Size uiSize = _ui->getContentSize();
	Size size = ModuleMgr::inst()->getGameViewSize();
	Point pos;
	pos.x = 0;
	pos.y = size.height - uiSize.height;
	_ui->setPosition( pos );
	addChild(_ui);  

	_hpPro = dynamic_cast<LoadingBar*>( _ui->getChildByTag( 1 ) );
	_mpPro = dynamic_cast<LoadingBar*>( _ui->getChildByTag( 3 ) );

	_hpText = dynamic_cast<Label*>( _ui->getChildByTag( 5 ) );
	_mpText = dynamic_cast<Label*>( _ui->getChildByTag( 6 ) );

	return true;
}

void HeadView::update( float delta )
{

}
